/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pojo;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author pvhuy
 */
@Entity
@Table(name=ChiTietDonDatHang.TABLE_CHITIETDONHANG)
public class ChiTietDonDatHang extends Base{
    public static final String TABLE_CHITIETDONHANG = "ChiTietDonDatHang";

    protected static final String COLUMN_SANPHAM = "MaSanPham";
    //@ManyToOne(cascade=CascadeType.ALL)
    @ManyToOne
    @JoinColumn(name=COLUMN_SANPHAM)
    private SanPham sanPham;

    protected static final String COLUMN_SOLUONG = "SoLuong";
    @Column(name=COLUMN_SOLUONG)
    private int soLuong;

    protected static final String COLUMN_DONGIA = "DonGia";
    @Column(name=COLUMN_DONGIA)
    private float donGia;

    protected static final String COLUMN_DONDATHANG = "MaDonDatHang";
    @ManyToOne(cascade=CascadeType.ALL)
    @JoinColumn(name=COLUMN_DONDATHANG)
    private DonDatHang donDatHang;

    /**
     * @return the sanPham
     */
    public SanPham getSanPham() {
        return sanPham;
    }

    /**
     * @param sanPham the sanPham to set
     */
    public void setSanPham(SanPham sanPham) {
        this.sanPham = sanPham;
    }

    /**
     * @return the soLuong
     */
    public int getSoLuong() {
        return soLuong;
    }

    /**
     * @param soLuong the soLuong to set
     */
    public void setSoLuong(int soLuong) {
        this.soLuong = soLuong;
    }

    /**
     * @return the donGia
     */
    public float getDonGia() {
        return donGia;
    }

    /**
     * @param donGia the donGia to set
     */
    public void setDonGia(float donGia) {
        this.donGia = donGia;
    }

    /**
     * @return the donDatHang
     */
    public DonDatHang getDonDatHang() {
        return donDatHang;
    }

    /**
     * @param donDatHang the donDatHang to set
     */
    public void setDonDatHang(DonDatHang donDatHang) {
        this.donDatHang = donDatHang;
    }

}
